﻿<div id="pbody" class="pbody_style2">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_setting"></span><span class="t t_c">快速设置</span>
        </div>
        <form action="/m/quickSetting/SettingSiteExtend" method="post" enctype="multipart/form-data">
            <div id="main">
                <div class="step">
                    <ul>
                        <li><span class="ico ico_step_over"></span><span class="t">基本信息</span>
                        </li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_current"></span><span class="t">扩展信息</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">内容结构</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">菜单结构</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">网站外观</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">权限设置</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">性能设置</span></li>
                        <li><i></i></li>
                        <li><span class="ico ico_step_noover"></span><span class="t">完成</span></li>
                    </ul>
                </div>
                <div class="table_form form_main step_content">
                    <table>
                        <tbody class="js-field">
                            @foreach (var item in ViewBag.SiteExtendList) {
                                <tr>
                                    <th width="60"><span class="info_txt">字段名称：</span></th>
                                    <td width="230">
                                        <input class="text w_20" name="remark" type="text" value="@item.Title" />
                                    </td>
                                    <th width="60"><span class="info_txt">字段代码：</span></th>
                                    <td>
                                        <input class="text w_20" name="name" type="text" value="@item.FieldName" />
                                        <label class="fun">
                                            <input type="button" class="btn_2 setting_field_del" value="删除"
                                                data-js="setting_field_del" /></label>
                                        <input type="hidden" name="json" value='{"id":"@item.Id","refId":"@item.SiteId","page":"@item.Group.Id","type":"@item.FieldType","remark":"@item.Title","name":"@item.FieldName"}'/>
                                    </td>
                                </tr>
                            }

                        </tbody>
                    </table>
                    <div class="fieldtype setting_field_add" style="background-color: #ffffff">
                        <ul class="clearfix">
                            @foreach (var item in @ViewBag.FieldTypeList) {
                                <li data-type="@item.Value">@item.Key</li>
                            }
                        </ul>
                    </div>
                </div>
                <div class="ml_34 p_2">
                    <a class="btn_1 mr_2 enable" href="/m/quickSetting/SettingSite">上一步</a><input type="submit"
                        class="btn_1" value="下一步" />
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $(document).ready(function () {
        $('.setting_field_add li').click(function () {
            var type = $(this).attr('data-type');
            var html = '<tr><th width="60"><span class="info_txt">字段名称：</span></th><td width="60"><input  name="remark" class="text w_20" type="text" value="" /><th width="60"><span class="info_txt">字段代码：</span></th><td><input name="name" class="text w_20" type="text" value="" /><label class="fun"><input type="button" class="btn_2 setting_field_del" value="删除"data-js="setting_field_del" /></label><input type="hidden" name="json" value=' + '{"id":"0","refId":"@ViewBag.Site.Id","page":"@ViewBag.Group.Id","type":"' + type + '","remark":"","name":""}' + '></td></tr>';
            $('.js-field').append(html);
        });

        $("form").find("input[type='submit']").click(function () {
            $(".js-field tr").each(function () {
                var $this = $(this);
                var value = $this.find("input[name='json']").val();
                var valueOjb = eval("(" + value + ")");
                if (valueOjb != null) {
                    valueOjb.remark = $this.find("input[name='remark']").val();
                    valueOjb.name = $this.find("input[name='name']").val();
                }
                $this.find("input[name='json']").val(JSON.stringify(valueOjb));
            })

        })
    });

</script>
